package cn.yuli.duck;

import cn.yuli.fly.Fly;
import cn.yuli.talk.Talk;

/**
 * 策略模式，鸭子抽象类
 * @author yuli
 *
 */
public abstract class Duck {
	private Fly fly;//封装出的飞行算法
	private Talk talk;//封装出的叫算法
	public Duck() {
		
	}
	
	public Duck(Fly fly, Talk talk) {
		super();
		this.fly = fly;
		this.talk = talk;
	}

	/**
	 * 展现鸭子
	 */
	public abstract void display();
	/**
	 * 飞行方法
	 */
	public void flying(){
		fly.flying();
	}
	/**
	 * 叫方法
	 */
	public void talking(){
		talk.talking();
	}
}
